From 42a5d02afb1ffb7d56ceef10fe1fee37bbb3797e Mon Sep 17 00:00:00 2001 From: "emellor@ewan" Date: Thu, 22 Sep 2005 18:03:16 +0100 Subject: [PATCH] Move variable initialisation out of import section. Remove obsolete save parameter from XendDominInfo.exportToDB. --- tools/python/xen/xend/XendDomain.py | 14 ++++++++++---- tools/python/xen/xend/XendDomainInfo.py | 6 +++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/tools/python/xen/xend/XendDomain.py b/tools/python/xen/xend/XendDomain.py index c641e29a32..69b971b536 100644 --- a/tools/python/xen/xend/XendDomain.py +++ b/tools/python/xen/xend/XendDomain.py @@ -23,13 +23,13 @@ """ import os -import xen.lowlevel.xc; xc = xen.lowlevel.xc.new() +import xen.lowlevel.xc from xen.xend import sxp -from xen.xend import XendRoot; xroot = XendRoot.instance() +from xen.xend import XendRoot from xen.xend import XendCheckpoint from xen.xend.XendDomainInfo import XendDomainInfo, shutdown_reason -from xen.xend import EventServer; eserver = EventServer.instance() +from xen.xend import EventServer from xen.xend.XendError import XendError from xen.xend.XendLogging import log from xen.xend import scheduler @@ -39,6 +39,12 @@ from xen.xend.xenstore import XenNode, DBMap from xen.xend.xenstore.xstransact import xstransact from xen.xend.xenstore.xsutil import GetDomainPath + +xc = xen.lowlevel.xc.new() +xroot = XendRoot.instance() +eserver = EventServer.instance() + + __all__ = [ "XendDomain" ] SHUTDOWN_TIMEOUT = 30 @@ -182,7 +188,7 @@ class XendDomain: if info.getDomid() in self.domains: notify = False self.domains[info.getDomid()] = info - info.exportToDB(save=True) + info.exportToDB() if notify: eserver.inject('xend.domain.create', [info.getName(), info.getDomid()]) diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index b61f11c25e..00ab50a53a 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -444,7 +444,7 @@ class XendDomainInfo: return xstransact.Store(self.path, *args) - def exportToDB(self, save=False): + def exportToDB(self): to_store = { 'domid': str(self.domid), 'uuid': self.uuid, @@ -718,7 +718,7 @@ class XendDomainInfo: # Create domain devices. self.construct_image() self.configure() - self.exportToDB(save=True) + self.exportToDB() except Exception, ex: # Catch errors, cleanup and re-raise. print 'Domain construction error:', ex @@ -739,7 +739,7 @@ class XendDomainInfo: ssidref = self.info['ssidref']) if self.domid <= 0: raise VmError('Creating domain failed: name=%s' % - self.vm.getName()) + self.info['name']) if self.info['bootloader']: self.image.handleBootloading() -- 2.30.2